{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Getting started with Jupyter Notebooks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Contents\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* [Goal](#Goal)\n",
    "\n",
    "\n",
    "* [Navigating the Notebook's cell-based interface](#Navigating-the-Notebook's-cell-based-interface)\n",
    "\n",
    "\n",
    "* [Markdown basics](#Markdown-basics)\n",
    "\n",
    "\n",
    "* [Including youtube videos](#Including-youtube-videos)\n",
    "\n",
    "\n",
    "* [Python's help system](#Python's-help-system)\n",
    "\n",
    "\n",
    "----\n",
    "\n",
    "## Goal"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The aim of this notebook is to get you up-and-running quickly with Jupyter Notebooks.  To be effective, you should become familiar with the \n",
    "\n",
    "* Notebook's browser-based interface\n",
    "\n",
    "\n",
    "* Writing text with Markdown\n",
    "\n",
    "\n",
    "* Writing and running Python scripts\n",
    "\n",
    "\n",
    "* The IPython interpreter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Quick Start\n",
    "\n",
    "### Jupyter Notebooks\n",
    "\n",
    "This is a Jupyter Notebook. The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine learning and much more.\n",
    "\n",
    "A Notebook consists of cells that are used to write code, or to record explanatory notes and comments. Notebooks are working documents that can be modified. It is good practice to save a copy of the original notebook before you start to edit. \n",
    "\n",
    "You can do this now from the Notebook Menubar by selecting **File > Make a copy... **. Continue this guide from the new copy. \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Navigating the Notebook's cell-based interface"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Fortunately, the quickest introduction to the Jupyter Notebook's browser-based interface is built in to the Notebook itself.\n",
    "\n",
    "![Notebook User Interface Tour](./images/Notebook_Tour.png)\n",
    "\n",
    "From the Notebook Menubar, first select `Help` and then select the `User Interface Tour` as shown in the diagram above.  Using a mouse, or the right and left keyboard keys, complete the short overview of the Notebook.\n",
    "\n",
    "The Notebook can be navigated using the tool and menu bars or using keyboard shortcuts.  A Notebook command palette with integrated search is activated by selecting the button with the keyboard option on the toolbar, as shown below,\n",
    "\n",
    "![Command Palette Button](./images/Command_Palette_Button.png)\n",
    "\n",
    "or by simultaneously pressing the `Ctrl` + `Shift` + `p` keys.  The command palette itself is shown below:\n",
    "\n",
    "![Command Palette](./images/Command_Palette.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Markdown basics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can write notes and comments in the `Markdown` cells of a notebook using Markdown syntax.  Note that there are a variety of popular markdown languages that differ only in their expressiveness.  The Markdown supported by Jupyter Notebooks is described in the following section.  It is similar but not identical to Github Flavor Markdown (GFM). \n",
    "\n",
    "This cell is a **Markdown cell**. Double click it now to see the raw markdown.\n",
    "\n",
    "Execute the cell to render the markdown. \n",
    "\n",
    "* Note in the dropdown box in the toolbar that this is a Markdown cell. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Markdown syntax examples"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[Headers](#Headers)  \n",
    "[Emphasis](#Emphasis)  \n",
    "[Lists](#Lists)  \n",
    "[Links](#Links)  \n",
    "[Images](#Images)  \n",
    "[Python script highlighting](#Python-script-highlighting)  \n",
    "[Tables](#Tables)  \n",
    "[Blockquotes](#Blockquotes)  \n",
    "[Horizontal Rule](#Horizontal-Rule)  \n",
    "[Line Breaks](#Line-Breaks)  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Headers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Header 1\n",
    "## Header 2\n",
    "### Header 3\n",
    "#### Header 4, etc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Emphasis"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Emphasis, aka italics, with *asterisks* or _underscores_.\n",
    "\n",
    "Strong emphasis, aka bold, with **asterisks** or __underscores__.\n",
    "\n",
    "Combined emphasis with **asterisks and _underscores_**.\n",
    "\n",
    "Strikethrough uses two tildes. ~~Scratch this.~~"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Lists"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. First ordered list item\n",
    "2. Another item\n",
    "  * Unordered sub-list. \n",
    "1. Actual numbers don't matter, just that it's a number\n",
    "  1. Ordered sub-list\n",
    "4. And another item."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Links"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "[Google](https://www.google.com)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Images"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "![jupyter](http://jupyter.org/assets/nav_logo.svg)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Python script highlighting"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We use single back-ticks for highlighting short segments of code or triple backtick pairs to enclose longer sections\n",
    "\n",
    "__Example 1:__  \n",
    "The Python `print` function is ...\n",
    "\n",
    "__Example 2:__\n",
    "```python\n",
    "\"\"\"A case-sensitive and white-space sensitive palindrome checker\"\"\" \n",
    "\n",
    "from math import floor\n",
    "\n",
    "pattern = input('Type a pattern that you want to verify is a palindrome: ')\n",
    "if pattern == (pattern[::-1]):\n",
    "    print ('\\nYes ... \"{}\"  is a palindrome'.format(pattern))\n",
    "else:\n",
    "    print ('\\nNo ... \"{}\"  is not a valid palindrome'.format(pattern))\n",
    "    length = len(pattern)\n",
    "    mid_pos = floor(length/2)\n",
    "    for i, char in enumerate(pattern):\n",
    "        i_dual = length - 1 - i\n",
    "        if i < mid_pos:\n",
    "            if pattern[i] != pattern[i_dual]:\n",
    "                print('The character \\'{}\\' in position {}  does not match the character \\'{}\\' in position {}'.\n",
    "                    format(pattern[i], i+1, pattern[i_dual], length-i))\n",
    "        else:\n",
    "            break  # All inconsistent chars on LHS and RHS identified\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "| Heading 1     | Heading 2     | Heading 3  |\n",
    "|---------------|---------------|------------|\n",
    "| C1 R1         | C2 R1         | C3 R1      |\n",
    "| C1 R2         | C2 R2         | C3 R2      |\n",
    "| C1 R3         | C2 R3         | __C3 R3__      |\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Blockquotes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "> Blockquotes are very handy in email to emulate reply text.\n",
    "> This line is part of the same quote.\n",
    "\n",
    "Quote break.\n",
    "\n",
    "> This is a very long line that will still be quoted properly when it wraps. Oh boy let's keep writing to make sure this is long enough to actually wrap for everyone. Oh, you can *put* **Markdown** into a blockquote. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Horizontal Rule"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Line Breaks"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "```\n",
    "Here's a line for us to start with.\n",
    "\n",
    "This line is separated from the one above by two newlines, so it will be a *separate paragraph*.\n",
    "\n",
    "This line is also a separate paragraph, but...\n",
    "This line is only separated by a single newline, so it's a separate line in the *same paragraph*.\n",
    "```\n",
    "\n",
    "Here's a line for us to start with.\n",
    "\n",
    "This line is separated from the one above by two newlines, so it will be a *separate paragraph*.\n",
    "\n",
    "This line is also begins a separate paragraph, but...  \n",
    "This line is only separated by a single newline, so it's a separate line in the *same paragraph*."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Including youtube videos"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from IPython.display import YouTubeVideo\n",
    "YouTubeVideo('7eQYZGf9--0')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Python's help system"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Python help system is extensive.  Run the two cells below to see two equivalent ways to access it:\n",
    "\n",
    "__Note__: type `quit` to exit the first cell"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": false
   },
   "outputs": [],
   "source": [
    "help()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "help(range)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "----\n",
    "\n",
    "[Contents](#Contents)\n",
    "\n",
    "----"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
